
% A2a_format_entry
%==========================================================================

% Description: This code cleans and formats the data for the entry case and
% removes outliers

clear
clc

load('P_summary.mat');

P_summary = P_summary(P_summary.mc_flag == 1, :);
P_summary = P_summary(abs(P_summary.beta_price_80) > 0.6, :);
P_summary = P_summary(abs(P_summary.beta_price_20) > 0.6, :);
P_summary = P_summary(P_summary.P_true_k_sorted_20 ~= Inf, :);
P_summary = P_summary(P_summary.P_true_k_sorted_80 ~= Inf, :);
P_summary = P_summary(P_summary.P_counter_k_sorted_20 ~= Inf, :);
P_summary = P_summary(P_summary.P_counter_k_sorted_80 ~= Inf, :);

P_summary.diff = P_summary.P_counter_k_sorted_20 ./ P_summary.P_true_k_sorted_20 - P_summary.P_counter_k_sorted_80 ./ P_summary.P_true_k_sorted_80;     
P_summary = P_summary(abs(P_summary.diff) < 1, :);

P_summary.mc_flag = [];
P_summary.price = [];
P_summary.diff = [];

writetable(P_summary, 'P_summary_format.csv', 'Delimiter',',','QuoteStrings',true);

